# DEPENDEBCIES
lappend auto_path d:/codes/tcl/tank/lib
package require anonymous
namespace import ::anonymous::*

# PACKAGE
package provide seqUtils 0.1

# IMPORT

# ARGS

# MAIN
namespace eval seqUtils {
    namespace export *

    proc map {seq anonymous} {
        set result {}
        foreach e $seq {
            lappend result [~ $anonymous $e]
        }
        return $result
    }

    proc filter {seq anonymous} {
        set result {}
        foreach e $seq {
            if [~ $anonymous $e] {
                lappend result $e
            }
        }
        return $result
    }

    proc reduce {seq anonymous initVal} {
        foreach e $seq {
            set initVal [~ $anonymous $initVal $e]
        }
        return $initVal
    }
}


